home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 2: Applications / Linux Cubed Series 2 - Applications.iso / editors / emacs / xemacs / xemacs-1.006 / xemacs-1 / lib / xemacs-19.13 / info / viper.info-3 < prev    next >
Encoding:
GNU Info File  |  1995-09-01  |  48.7 KB  |  1,330 lines

  1. This is Info file ../info/viper.info, produced by Makeinfo-1.63 from
  2. the input file viper.texi.
  3.  
  4. Distribution
  5. ************
  6.  
  7. Copyright (C) 1991 Aamod Sane
  8. Copyright (C) 1994 Michael Kifer
  9.  
  10.    Permission is granted to make and distribute verbatim copies of this
  11. manual provided the copyright notice and this permission notice are
  12. preserved on all copies.
  13.  
  14.    Permission is granted to copy and distribute modified versions of
  15. this manual under the conditions for verbatim copying, provided that
  16. the entire resulting derived work is distributed under the terms of a
  17. permission notice identical to this one.
  18.  
  19.    Permission is granted to copy and distribute translations of this
  20. manual into another language, under the same conditions as for modified
  21. versions.
  22.  
  23. 
  24. File: viper.info,  Node: Viper Specials,  Next: Vi Macros,  Prev: Packages that Change Keymaps,  Up: Customization
  25.  
  26. Viper Specials
  27. ==============
  28.  
  29.    Viper extends Vi with a number of useful features. This includes
  30. various search functions, histories of search strings, Ex commands,
  31. insertions, and Vi's destructive commands. In addition, Viper supports
  32. file name completion and history, completion of Ex commands and
  33. variables, and many other features. Some of these features are
  34. explained in detail elsewhere in this document. Other features are
  35. explained here.
  36.  
  37. `(vip-buffer-search-enable)'
  38. `vip-buffer-search-char nil'
  39.      Enable buffer search. Explicit call to `vip-buffer-search-enable'
  40.      sets `vip-buffer-search-char' to `g'. Alternatively, the user can
  41.      set `vip-buffer-search-char' in `.vip' to a key sequence to be
  42.      used for buffer search. There is no need to call
  43.      `vip-buffer-search-enable' in that case.
  44.  
  45. `vip-toggle-search-style'
  46.      This function, bound to `C-c /', lets one toggle case-sensitive and
  47.      case-insensitive search, and also switch between plain vanilla
  48.      search and search via regular expressions. Without the prefix
  49.      argument, the user is asked which mode to toggle. With prefix
  50.      argument 1, this toggles case-sensitivity. With prefix argument 2,
  51.      regular expression/vanilla search will be toggled.
  52.  
  53.      However, we found that the most convenient way to toggle these
  54.      options is to bind a Vi macro to bind `//' to toggles case
  55.      sensitivity and to `///' to toggles vanilla search. Thus, quickly
  56.      hitting `/' twice will switch Viper from case sensitive search to
  57.      case-insensitive. Repeating this once again will restore the
  58.      original state. Likewise, quickly hitting `/' three times will
  59.      switch you from vanila-style search to search via regular
  60.      expressions.  If you hit something other than `/' after the first
  61.      `/' or if the second `/' doesn't follow quickly enough, then Viper
  62.      will issue the usual prompt `/' and will wait for input, as usual
  63.      in Vi.  If you don't like this behavior, you can "unrecord" these
  64.      macros in your `~/.vip' file. For instance, if u don't like the
  65.      above feature, put this in `~/.vip':
  66.           (vip-unrecord-kbd-macro "//" 'vi-state)
  67.           (vip-unrecord-kbd-macro "///" 'vi-state)
  68.  
  69.      *Note Vi Macros::, for more information on Vi macros.
  70.  
  71. `vip-heading-start'
  72. `vip-heading-end'
  73.      Regular Expressions for `[[' and `]]'. Note that Emacs defines
  74.      Regexps for paragraphs and sentences. *Note Paragraphs and
  75.      Sentences: (emacs)Paragraphs, for details.
  76.  
  77. `M-x vip-set-expert-level'
  78.      Change your user level interactively.
  79.  
  80. `vip-smart-suffix-list  '("" "tex" "c" "cc" "el" "p")'
  81.      Viper supports Emacs-style file completion when it prompts the
  82.      user for a file name. However, in many cases, the same directory
  83.      may contain files with identical prefix but different suffixes,
  84.      e.g., prog.c, prog.o, paper.tex, paper.dvi. In such cases,
  85.      completion will stop at the `.'.  If the above variable is a list
  86.      of strings representing suffixes, Viper will try these suffixes in
  87.      the order listed and will check if the corresponding file exists.
  88.  
  89.      For instance, if completion stopped at `paper.' and the user typed
  90.      RET, then Viper will check if the files `paper.', `paper.tex',
  91.      `paper.c', etc., exist.  It will take the first such file. If no
  92.      file exists, Viper will give a chance to complete the file name by
  93.      typing the appropriate suffix. If `paper.' was the intended file
  94.      name, hitting return will accept it.
  95.  
  96.      To turn this feature off, set the above variable to `nil'.
  97.  
  98. `vip-insertion-ring-size  14'
  99.      Viper remembers what was previously inserted in Insert and Replace
  100.      states.  Several such recent insertions are kept in a special ring
  101.      of strings of size `vip-insertion-ring-size'.  If you enter Insert
  102.      or Replace state you can reinsert strings from this ring by typing
  103.      `C-c M-p' or `C-c M-n'. The former will search the ring in the
  104.      direction of older insertions, and the latter will search in the
  105.      direction of newer insertions. Hitting `C-c M-p' or `C-c M-n' in
  106.      succession will undo the previous insertion from the ring and
  107.      insert the next item on the ring. If a larger ring size is needed,
  108.      change the value of the above variable in the `~/.vip' file.
  109.  
  110.      Since typing these sequences of keys may be tedious, it is
  111.      suggested that the user should bind a function key, such as `f31',
  112.      as follows:
  113.           (define-key vip-insert-global-user-map [f31]
  114.                       'vip-insert-prev-from-insertion-ring)
  115.      This binds `f31' (which is usually `R11' on a Sun workstation) to
  116.      the function that inserts the previous string in the insertion
  117.      history.  To rotate the history in the opposite direction, you can
  118.      either bind an unused key to `vip-insert-next-from-insertion-ring'
  119.      or hit any digit (1 to 9) then `f31'.
  120.  
  121.      One should not bind the above functions to `M-p' or `M-n', since
  122.      this will interfere with the Minibuffer histories and, possibly,
  123.      other major modes.
  124.  
  125. `vip-command-ring-size  14'
  126.      Viper keeps track of the recent history of destructive commands,
  127.      such as `dw', `i', etc.  In Vi state, the most recent command can
  128.      be re-executed by hitting ``.'', as in Vi.  However, repeated
  129.      typing `C-c M-p' will cause Viper to show the previous destructive
  130.      commands in the minibuffer. Subsequent hitting ``.'' will execute
  131.      the command that was displayed last.  The key `C-c M-n' will cycle
  132.      through the command history in the opposite direction.  Since
  133.      typing `C-c M-p' may be tedious, it is more convenient to bind an
  134.      appropriate function to an unused function key on the keyboard and
  135.      use that key. For instance, the following
  136.           (define-key vip-vi-global-user-map [f31]
  137.                       'vip-prev-destructive-command)
  138.      binds the key `f31' (which is usually `R11' on a Sun workstation)
  139.      to the function that searches the command history in the direction
  140.      of older commands. To search in the opposite direction, you can
  141.      either bind an unused key to `vip-next-destructive-command' or hit
  142.      any digit (1 to 9) then `f31'.
  143.  
  144.      One should not bind the above functions to `M-p' or `M-n', since
  145.      this will interfere with the Minibuffer histories and, possibly,
  146.      other major modes.
  147.  
  148. `vip-minibuffer-vi-face  'vip-minibuffer-vi-face'
  149. `vip-minibuffer-insert-face  'vip-minibuffer-insert-face'
  150. `vip-minibuffer-emacs-face  'vip-minibuffer-emacs-face'
  151.      These faces control the appearance of the minibuffer text in the
  152.      corresponding Viper states. For heavy-duty customization, consult
  153.      the Lisp Reference to Emacs. You can also take a look how these
  154.      faces are defined in `viper.el'.
  155.  
  156.      However, on a color workstation, the following method usually
  157.      suffices:
  158.           (set-face-foreground vip-minibuffer-vi-face "blue")
  159.           (set-face-background vip-minibuffer-emacs-face "orchid")
  160.      This will make a blue foreground in the Minibuffer when it is in Vi
  161.      state; its background will turn to orchid when it switches to
  162.      Emacs state.
  163.  
  164.      Note that only the text you type in is affected by the above faces.
  165.      Prompts and Minibuffer messages are not affected.
  166.  
  167.      Purists who do not like adornments in the minibuffer can always
  168.      zap them by putting
  169.           (copy-face 'default 'vip-minibuffer-vi-face)
  170.           (copy-face 'default 'vip-minibuffer-insert-face)
  171.           (copy-face 'default 'vip-minibuffer-emacs-face)
  172.      in the `~/.vip' file. However, in that case, the user will not
  173.      have any indication of the current Viper state in the minibuffer.
  174.      (This is important if the user accidentally switches to another
  175.      Viper state by typing `ESC' or `C-z'.
  176.  
  177.    Viper provides some support for multi-file documents and programs.
  178. If a document consists of several files we can designate one of them as
  179. a master and put the following at the end of that file:
  180.      ;;; Local Variables:
  181.      ;;; eval: (vip-setup-master-buffer "file1" "file2" "file3" "file5" "file5")
  182.      ;;; End:
  183.  
  184. where `file1' to `file5' are names of files related to the master file.
  185. Next time, when the master file is visited, the command
  186. `vip-setup-master-buffer' will be evaluated and the above files will be
  187. associated with the master file. Then, the new Ex command
  188. `:RelatedFile' (abbr. `:R') will display files 1 to 5 one after
  189. another, so you can edit them. If a file is not in any Emacs buffer, it
  190. will be visited.  The command `PreviousRelatedFile' (abbr., `:P') goes
  191. through the file list in the opposite direction.
  192.  
  193.    These commands are akin to `:n' and `:N', but they allow the user to
  194. focus on relevant files only.
  195.  
  196.    Note that only the master file needs to have the aforementioned
  197. block of commands. Also, ";;;" above can be replaced by some other
  198. markers. Semicolon is good for Lisp programs, since it is considered a
  199. comment designator there. For LaTeX, this could be "%%%", and for C the
  200. above block should be commented out.
  201.  
  202.    Even though these commands are sometimes useful, they are no
  203. substitute for the powerful *tag table* facility of Emacs. Viper's
  204. `:tag' command in a primitive interface to Emacs tags. *Note Tags:
  205. (emacs)Tags, for more information on tags.
  206.  
  207.    The following two commands are normally bound to a mouse click and
  208. are part of Viper. They work only if Emacs runs as an application under
  209. X Windows (or under some other window system for which a port of GNU
  210. Emacs 19 is available). Clicking the mouse when Emacs is invoked in an
  211. Xterm window (using `emacs -nw') will do no good.
  212.  
  213. `S-mouse-1 (Emacs)'
  214. `meta button1up (XEmacs)'
  215.      Holding Shift and clicking mouse button 1 (or holding Meta key and
  216.      clicking, if in XEmacs) will initiate search for a region under
  217.      the mouse pointer (defined below).  This command can take a prefix
  218.      argument, which indicates the occurrence of the pattern to search
  219.      for.
  220.  
  221.      Note: Viper binds this mouse action only if it is not already
  222.      bound to something else. If you want to use this feature and
  223.      `S-mouse-1' is already used for something else, you can rebind
  224.      mouse-search as follows:
  225.           (global-set-key [M-mouse-1] 'vip-mouse-click-search-word)
  226.           (global-set-key [M-down-mouse-1] 'vip-mouse-catch-frame-switch)
  227.      This would bind mouse search to the action invoked by pressing the
  228.      Meta key and clicking mouse button 1. Note: if
  229.      `vip-mouse-click-search-word' is bound to an action, then
  230.      `vip-mouse-catch-frame-switch' must be bound to a down-action, as
  231.      shown in the above example.
  232.  
  233.      In XEmacs, you can change bindings as follows:
  234.           (global-set-key [(meta shift button1up)]
  235.                           'vip-mouse-click-search-word)
  236.           (global-set-key [(meta shift button1)]
  237.                           'vip-mouse-catch-frame-switch)
  238.      if, say, you prefer to hold both meta and shift while clicking.
  239.      The reason why Viper uses different bindings for Emacs and XEmacs
  240.      is because these two incarnations of Emacs have different default
  241.      bindings for mouse actions.
  242.  
  243.      Like in Emacs, there are special rules for binding these
  244.      functions: the first must be bound to a button-up event while the
  245.      second must be bound to a button-event (which is XEmacs'
  246.      equivalent of a down-mouse event).  Also, in Emacs, the
  247.      double-click and triple-click actions for the same button
  248.      (`double-S-mouse-1', etc., if the above default binding is used)
  249.      should not be bound (or it should be bound to the same function,
  250.      `vip-mouse-click-search-word').
  251.  
  252.      The region that is chosen as a pattern to search for is determined
  253.      as follows. If search is invoked via a single click, Viper chooses
  254.      the region that lies between the beginning of the "word" under the
  255.      pointer ("word" is understood in Vi sense) and the end of that
  256.      word.  The only difference with Vi's words is that in Lisp major
  257.      modes `-' is considered an alphanumeric symbol. This is done for
  258.      the convenience of working with Lisp symbols, which often have an
  259.      `-' in them.  Also, if you click on a non-alphanumeric character
  260.      that is not a word separator (in Vi) then this character will also
  261.      be considered alphanumeric, provided that it is adjacent (from
  262.      either side) to an alphanumeric character.  This useful feature
  263.      gives added control over the patterns selected by the mouse click.
  264.  
  265.      On a double-click, the region is determined by the beginning of
  266.      the current Vi's "Word" (i.e., the largest non-separator chunk of
  267.      text) and the End of that "Word" (as determined by the `E'
  268.      command).
  269.  
  270.      On a triple-click, the region consists of the line where the click
  271.      occurred with all leading and trailing spaces and tabs removed.
  272.  
  273. `S-mouse-2 (Emacs)'
  274. `meta button2up (XEmacs)'
  275.      Holding Shift and clicking button 2 (or holding Meta key and
  276.      clicking, if in XEmacs) of the mouse will insert the region
  277.      surrounding the mouse pointer.  The rules defining this region are
  278.      the same as for mouse-search.  This command takes an optional
  279.      prefix argument, which indicates how many such regions to snarf
  280.      from the buffer and insert.  (In case of a triple-click, the
  281.      prefix argument is ignored.)
  282.  
  283.      Note: Viper binds this mouse action only if it not already bound to
  284.      something else. If you want to use this feature and `S-mouse-2' is
  285.      already used for something else, you can rebind mouse-insert as
  286.      follows:
  287.           (global-set-key [M-mouse-2] 'vip-mouse-click-insert-word)
  288.           (global-set-key [M-down-mouse-2] 'vip-mouse-catch-frame-switch)
  289.      In XEmacs, you can change the bindings as follows:
  290.           (global-set-key [(meta shift button2up)]
  291.                           'vip-mouse-click-insert-word)
  292.           (global-set-key [(meta shift button2)]
  293.                           'vip-mouse-catch-frame-switch)
  294.  
  295. `vip-multiclick-timeout'
  296.      This variable controls the rate at which double-clicking must
  297.      occur for the purpose of mouse search and mouse insert. By
  298.      default, this is set to `double-click-time' in Emacs and to
  299.      `mouse-track-multi-click-time' milliseconds in XEmacs.
  300.  
  301.    Note: The above functions search and insert in the selected window of
  302. the latest active frame. This means that you can click in another
  303. window or another frame and have search or insertion done in the frame
  304. and window you just left.  This lets one use these functions in a
  305. multi-frame configuration.  However, this may require some getting used
  306. to. For instance, if you are typing in a frame, A, and then move the
  307. mouse to frame B and click to invoke mouse search, search (or
  308. insertion) will be performed in frame A. To perform search/insertion in
  309. frame B, you will first have to shift focus there, which doesn't happen
  310. until you type a character or perform some other action in frame
  311. B--mouse search doesn't shift focus (in XEmacs, to shift focus to frame
  312. B, you will have to select this frame with a mouse, by clicking.
  313.  
  314.    If you decide that you don't like the above feature and always want
  315. search/insertion be performed in the frame where the click occurs, don't
  316. bind (and unbind, if necessary) `vip-mouse-catch-frame-switch' from the
  317. mouse event it is bound to.
  318.  
  319.    Mouse search is integrated with Vi-style search, so you can repeat
  320. it with `n' and `N'. It should be also noted that, while
  321. case-sensitivity of search in Viper is controlled by the variable
  322. `vip-case-fold-search', the case of mouse search is controlled by the
  323. Emacs variable `case-fold-search', which may be set differently from
  324. `vip-case-fold-search'. Therefore, case-sensitivity of mouse search may
  325. be different from that of the usual Vi-style search.
  326.  
  327.    Finally, if the way Viper determines the word to be searched for or
  328. to be inserted is not what you want, there is a variable,
  329. `vip-surrounding-word-function', which can be changed to indicate
  330. another function for snarfing words out of the buffer. The catch is that
  331. you will then have to write such a function and make it known to your
  332. Emacs. The function `vip-surrounding-word' in `viper.el' can be used as
  333. a guiding example.
  334.  
  335. 
  336. File: viper.info,  Node: Vi Macros,  Prev: Viper Specials,  Up: Customization
  337.  
  338. Vi Macros
  339. =========
  340.  
  341.    Viper supports much enhanced Vi-style macros and also facilitates
  342. the use of Emacs-style macros.  To define a temporary macro, it is
  343. generally more convenient to use Emacs keyboard macro facility. Emacs
  344. keyboard macros are usually defined anonymously, and the latest macro
  345. can be executed by typing `C-x e' (or `*', if Viper is in Vi state). If
  346. you need to use several temporary macros, Viper lets you save them to a
  347. register (a lowercase letter); such macros can then be executed by
  348. typing `@a' in Vi state (if a macro was previously saved in register
  349. `a').  *Note Macros and Registers::, for details.
  350.  
  351.    If, however, you need to use a macro regularly, it must be given a
  352. permanent name and saved. Emacs manual explains how to do this, but
  353. invocation of named Emacs macros is quite different from Vi's. First,
  354. invocation of permanent Emacs macros takes time because of the extra
  355. keys.  Second, binding such macros to function keys, for fast access,
  356. hogs valuable real estate on the keyboard.
  357.  
  358.    Vi-style macros are better in that respect, since Vi lets the user
  359. overload the meaning of key sequences: keys typed in fast succession
  360. are treated specially, if this key sequence is bound to a macro.
  361.  
  362.    Viper provides keyboard macros through the usual Ex commands, `:map'
  363. and `:map!'. Vi-style macros are much more powerful in Viper than they
  364. are in the original Vi and in other emulators. This is because Viper
  365. implements an enhanced vi-style interface to the powerful Emacs
  366. keyboard macro facility.
  367.  
  368.    First, any Emacs command can be executed while defining a macro, not
  369. just the Vi commands. In particular, the user can invoke Emacs commands
  370. via `M-x command-name' or by pressing various function keys on the
  371. keyboard. One can even use the mouse, although this is usually not
  372. useful and is not recommended (and macros defined with the use of the
  373. mouse cannot be saved in command history and in the startup file, for
  374. future use).
  375.  
  376.    Macros defined by mixing Vi and Emacs commands are represented as
  377. vectors. So, don't be confused when you see one (usually through the
  378. history of Ex commands). For instance, if `gg' is defined by typing
  379. `l', the up-arrow key and `M-x next-line', its definition will look as
  380. follows in Emacs (in XEmacs, it looks slightly different, see below):
  381.  
  382.      [l up (meta x) n e x t - l i n e return]
  383.  
  384.    Second, Viper macros are defined in a WYSIWYG style. This means that
  385. commands are executed as you type them, so you can see precisely what is
  386. being defined.  Third, macros can be bound to arbitrary sequences of
  387. keys, not just to printable keys. For instance, one can define a macro
  388. that will be invoked by hitting `f3' then `f2' function keys. (The keys
  389. `delete' and `backspace' are excluded; also, a macro invocation
  390. sequence can't start with ESC. Some other keys, such as `f1' and
  391. `help', can't be bound to macros under Emacs (not XEmacs), since they
  392. are bound in `key-translation-map', which overrides any other binding
  393. the user gives to keys. In general, keys that have a binding in
  394. `key-translation-map' can't be bound to a macro.)
  395.  
  396.    Fourth, in Viper, one can define macros that are specific to a given
  397. buffer, a given major mode, or macros that are defined for all buffers.
  398. In fact, the same macro name can have several different definitions:
  399. one global, several definitions for various major modes, and
  400. definitions for various specific buffers. Buffer-specific definitions
  401. override mode-specific definitions, which, in turn, override global
  402. definitions.
  403.  
  404.    As if all that is not enough, Viper (through its interface to Emacs
  405. macros) lets the user define keyboard macros that ask for confirmation
  406. or even prompt the user for input and then continue. To do this, one
  407. should type `C-x q' (for confirmation) or `C-u C-x q' (for prompt).
  408. For details, *note Customization: (emacs)Kbd Macro Query.
  409.  
  410.    When the user finishes defining a macro (which is done by typing
  411. `C-x)' -- a departure from Vi), you will be asked whether you want this
  412. macro to be global, mode-specific, or buffer-specific. You will also be
  413. given a chance to save the macro in your `~/.vip' file.  This is the
  414. easiest way to save a macro and make it permanently available. If you
  415. work your startup files with bare hands, here is how Viper saves the
  416. above macro so that it will be available in Viper's Insert state (and
  417. Replace state) in buffer `my-buf' only:
  418.  
  419.       (vip-record-kbd-macro "gg" 'insert-state
  420.              [l up (meta x) n e x t - l i n e return]
  421.              "my-buf")
  422.  
  423. To do the same for Vi state and all buffers with the major mode
  424. `cc-mode', use:
  425.  
  426.       (vip-record-kbd-macro "gg" 'vi-state
  427.              [l up (meta x) n e x t - l i n e return]
  428.              'cc-mode)
  429.  
  430. Both macro names and macro definitions are vectors of symbols that
  431. denote keys on the keyboard. Some keys, like `\', ` ', or digit-keys
  432. must be escaped with a backslash. Modified keys are represented as
  433. lists. For instance, holding Meta and Control and pressing `f4' is
  434. represented as `(control meta f4)'.  If all members of a vectors are
  435. printable characters (or sequences, such as `\e', `\t', for ESC and
  436. TAB), then they can also be represented as strings:
  437.  
  438.       (vip-record-kbd-macro "aa" 'vi-state  "aaa\e"  "my-buffer")
  439.  
  440. Thus, typing `aa' fast in Vi state will switch Viper to Insert state
  441. (due to the first `a'), insert `aa', and then it will switch back to Vi
  442. state. All this will take effect only in the buffer named `my-buffer'.
  443.  
  444.    Note that the last argument to `vip-record-kbd-macro' must be either
  445. a string (a buffer name), a symbol representing a major mode, or `t';
  446. the latter says that the macro is to be defined for all buffers (which
  447. is how macros are defined in original Vi).
  448.  
  449.    For convenience, Viper also lets you define Vi-style macros in its
  450. Emacs state. There is no Ex command, like `:map' and `:map!' for doing
  451. this, but the user can include such a macro in the `~/.vip' file. The
  452. only thing is that the `vip-record-kbd-macro' command should specify
  453. `'emacs-state' instead of `'vi-state' or `'insert-state'.
  454.  
  455.    The user can get rid of a macro either by using the Ex commands
  456. `:unmap' and `:unmap!' or by issuing a call to `vip-unrecord-kbd-macro'.
  457. The latter is more powerful, since it can delete macros even in
  458. `'emacs-state'. However, `vip-unrecord-kbd-macro' is usually needed
  459. only when the user needs to get rid of the macros that are already
  460. predefined in Viper.  The syntax is:
  461.      (vip-unrecord-kbd-macro macro state)
  462.  
  463. The second argument must be `'vi-state', `'insert-state', or
  464. `'emacs-state'. The first argument is a name of a macro.  To avoid
  465. mistakes in specifying names of existing macros, type `M-x
  466. vip-describe-kbd-macros' and use a name from the list displayed by this
  467. command.
  468.  
  469.    If an error occurs during macro definition, Emacs aborts the
  470. process, and it must be repeated. This is analogous to Vi, except that
  471. in Vi the user doesn't know there is an error until the macro is
  472. actually run. All that means that in order for a definition to be
  473. successful, the user must do some simple planning of the process in
  474. advance, to avoid errors.  For instance, if you want to map `gg' to
  475. `llll' in Vi state, you must make sure that there is enough room on the
  476. current line. Since `l' moves the cursor forward, it may signal an
  477. error on reaching the end of line, which will abort the definition.
  478.  
  479.    These precautions are necessary only when defining macros; they will
  480. help avoid the need to redo the job. When macros are actually run, an
  481. error during the execution will simply terminate the current execution
  482. (but the macro will remain mapped).
  483.  
  484.    A macro name can be a string of characters or a vector of keys.  The
  485. latter makes it possible to define macros bound to, say, double-hitts
  486. on a function key, such as `up' or `f13'.  This is very useful if you
  487. run out of function keys on your keyboard; it makes Viper macro
  488. facility a *keyboard doubler*, so to speak.
  489.  
  490.    Elsewhere (*Note Keybindings::, for details), we review the standard
  491. Emacs mechanism for binding function keys to commands.  For instance,
  492.  
  493.      (global-set-key [f13] 'repeat-complex-command)
  494.  
  495. binds the key f13 to the Emacs function that repeats the last minibuffer
  496. command. Under Viper, however, you may still use this key for additional
  497. purposes, if you bind, say, a double-hitting action for that key to some
  498. other function. Emacs doesn't allow the user to do that, but Viper does
  499. this through its keyboard macro facility. To do this, type `:map '
  500. first. When you are asked to enter a macro name, hit f13 twice,
  501. followed by RET or SPC.
  502.  
  503.    Emacs will now start the mapping process by actually executing Vi
  504. and Emacs commands, so that you could see what will happen each time the
  505. macro is executed. Suppose now we wanted to bind the key sequence `f13
  506. f13' to the command `eval-last-sexp'. To accomplish this, we can type
  507. `M-x eval-last-sexp' followed by `C-x )'.  If you answer positively to
  508. Viper's offer to save this macro in `~/.vip' for future uses, the
  509. following will be inserted in that file:
  510.  
  511.      (vip-record-kbd-macro [f16 f16] 'vi-state
  512.               [(meta x) e v a l - l a s t - s e x p]
  513.               'lisp-interaction-mode)
  514.  
  515.    To illustrate the above point, Viper provides two canned macros,
  516. which, by default, are bound to `[f12 \1]' and `[f12 \2]' (invoked by
  517. typing `f12' then `1' and `2', respectively).  These macros are useful
  518. shortcuts to Viper's command ring history.  The first macro will
  519. execute the second-last destructive command (the last one is executed
  520. by `.', as usual). The second macro executes the third-last command.
  521.  
  522.    If you need to go deeper into the command history, you will have to
  523. use other commands, as described earlier in this section; or you can
  524. bind, say, `f12 \3' like this:
  525.  
  526.      (vip-record-kbd-macro [f12 \3] 'vi-state
  527.                            [(meta x) r e p e a t - f r o m - h i s t o r y]
  528.                            t)
  529.  
  530.    Note that even though the macro uses the function key `f12', the key
  531. is actually free and can still be bound to some Emacs function via
  532. `define-key' or `global-set-key'.
  533.  
  534.    Viper allows the user to define macro names that are prefixes of
  535. other macros.  For instance, one can define `[[' and `[[[[' to be
  536. macros.  If you type the exact sequence of such keys and then pause,
  537. Viper will execute the right macro. However, if you don't pause and,
  538. say, type `[[[[text' then the conflict is resolved as follows. If only
  539. one of the key sequences, `[[' or `[[[[' has a definition applicable to
  540. the current buffer, then, in fact, there is no conflict and the right
  541. macro will be chosen. If both have applicable definitions, then the
  542. first one found will be executed. Usually this is the macro with a
  543. shorter name. So, in our case, `[[[[text' will cause the macro `[[' to
  544. be executed twice and then the remaining keys, `t e x t', will be
  545. processed.
  546.  
  547.    When defining macros using `:map' or `:map!', the user enters the
  548. actually keys to be used to invoke the macro. For instance, you should
  549. hit the actual key `f6' if it is to be part of a macro name; you do
  550. *not* write `f 6'. When entering keys, Viper displays them as strings or
  551. vectors (e.g., "abc" or [f6 f7 a]). The same holds for unmapping.
  552. Hitting TAB while typing a macro name in the `:unmap' or `:unmap!'
  553. command will cause name completion. Completions are displayed as
  554. strings or vectors.  However, as before, you don't actually type """,
  555. "[", or "]" that appear in the completions. These are meta-symbols that
  556. indicate whether the corresponding macro name is a vector or a string.
  557.  
  558.    One last difference from Vi: Vi-style keyboard macros cannot be
  559. defined in terms of other Vi-style keyboard macros (but named Emacs
  560. macros are OK).  More precisely, while defining or executing a macro,
  561. the special meaning of key sequences (as Vi macros) is ignored.  This
  562. is because it is all too easy to create an infinite loop in this way.
  563. Since Viper macros are much more powerful than Vi's it is impossible to
  564. detect such loops. In practice, this is not really a limitation but,
  565. rather, a feature.
  566.  
  567.    We should also note that Vi macros are disabled in the Minibuffer,
  568. which helps keep some potential troubles away.
  569.  
  570.    The rate at which the user must type keys in order for them to be
  571. recognized as a timeout macro is controlled by the variable
  572. `vip-fast-keyseq-timeout', which defaults to 200 milliseconds.
  573.  
  574.    For the most part, Viper macros defined in `~/.vip' can be shared
  575. between Emacs, XEmacs, and X and TTY modes.  However, macros defined via
  576. function keys may need separate definitions when XEmacs and Emacs have
  577. different names for the same keyboard key. For instance, the `Page Up'
  578. key may be known in Emacs as `prior' and in XEmacs as `pgup'.  The
  579. problem with TTY may be that the function keys there generate sequences
  580. of events instead of a single event (as under a window system).  Both
  581. Emacs and XEmacs mape some of these sequences back to the logical keys
  582. (e.g., the sequences generated by the arrow keys are mapped to `up',
  583. `left', etc.). However, not all function keys are mapped in this way.
  584. Macros that are bound to key sequences that contain such unmapped
  585. function keys have to be redefined for TTY's (and possibly for every
  586. type of TTY you may be using). To do this, start Emacs on an
  587. appropriate TTY device and define the macro using `:map', as usual.
  588.  
  589.    Finally, Viper provides a function that conveniently displays all
  590. macros currently defined. To see all macros along with their
  591. definitions, type `M-x vip-describe-kbd-macros'.
  592.  
  593. 
  594. File: viper.info,  Node: Commands,  Prev: Customization,  Up: Top
  595.  
  596.    Top
  597.  
  598. Commands
  599. ********
  600.  
  601.    This section is a semi-automatically bowdlerized version of the Vi
  602. reference created by
  603. `maart@cs.vu.nl' and others. It can be found on the Vi archives. Very
  604. little has been changed for Viper.
  605.  
  606. * Menu:
  607.  
  608. * Groundwork::            Textual Conventions and Viper basics
  609. * Text Handling::        Moving, Editing, Undoing.
  610. * Display::            Scrolling.
  611. * File and Buffer Handling::    Editing, Writing and Quitting.
  612. * Mapping::            Mapping Keys, Keyboard Macros
  613. * Shell Commands::        Accessing Shell Commands, Processing Text
  614. * Options::            Ex options, the `:set' commands
  615. * Emacs Related Commands::    Meta Keys, Windows
  616. * Mouse-bound Commands::        Search and insertion of text
  617.  
  618. 
  619. File: viper.info,  Node: Groundwork,  Next: Text Handling,  Prev: Commands,  Up: Commands
  620.  
  621. Groundwork
  622. ==========
  623.  
  624.    The VI command set is based on the idea of combining motion commands
  625. with other commands. The motion command is used as a text region
  626. specifier for other commands.  We classify motion commands into "point
  627. commands" and "line commands".
  628.  
  629.    The point commands are:
  630.  
  631.      `h', `l', `0',  `$', `w', `W', `b', `B', `e', `E', `(', `)', `/',
  632.      `?', ``', `f', `F', `t', `T', `%', `;', `,', `^'
  633.  
  634.    The line commands are:
  635.  
  636.      `j', `k', `+', `-', `H', `M', `L', `{', `}', `G', `'',  `[[',
  637.      `]]', `[]'
  638.  
  639. Text Deletion Commands (*Note Deleting Text::), Change commands (*Note
  640. Changing Text::), even Shell Commands (*Note Shell Commands::) use
  641. these commands to describe a region of text to operate on.
  642.  
  643.    Viper adds two region descriptors, `r' and `R'. These describe the
  644. Emacs regions (*Note Basics::), but they are not movement commands.
  645.  
  646.    The command description uses angle brackets `<>' to indicate
  647. metasyntactic variables, since the normal conventions of using simple
  648. text can be confusing with Viper where the commands themselves are
  649. characters. Watch out where `<' shift commands and `<count>' are
  650. mentioned together!!!
  651.  
  652.    `<move>' refers to the above movement commands, and `<a-z>' refers
  653. to registers or textmarkers from `a' to `z'. Note that the `<move>'  is
  654. described by full move commands, that is to say they will take counts,
  655. and otherwise behave like normal move commands.  `<address>' refers to
  656. Ex line addresses, which include
  657.  
  658. `. <No address>'
  659.      Current line
  660.  
  661. `.+n .-n'
  662.      Add or subtract for current line
  663.  
  664. `number'
  665.      Actual line number, use `.=' to get the line number
  666.  
  667. `'<a-z>'
  668.      Textmarker
  669.  
  670. `$'
  671.      Last line
  672.  
  673. `x,y'
  674.      Where x and y are one of the above
  675.  
  676. `%'
  677.      For the whole file, same as (1,$).
  678.  
  679. `/pat/'
  680. `?pat?'
  681.      Next or previous line with pattern pat
  682.  
  683.    Note that `%' is used in Ex commands to mean current file. If you
  684. want a `%' in your command, it must be escaped as `\%'.  Similarly, `#'
  685. expands to the previous file. The previous file is the first file in
  686. `:args' listing. This defaults to previous window in the VI sense if
  687. you have one window only.
  688.  
  689. Others like `<args> -- arguments', `<cmd> -- command' etc.  should be
  690. fairly obvious.
  691.  
  692. Common characters referred to include:
  693.  
  694. `<sp>'
  695.      Space
  696.  
  697. `<ht>'
  698.      Tab
  699.  
  700. `<lf>'
  701.      Linefeed
  702.  
  703. `<esc>'
  704.      Escape
  705.  
  706. `<cr>'
  707.      Return, Enter
  708.  
  709.    We also use `word' for alphanumeric/non-alphanumeric words, and
  710. `WORD' for whitespace delimited words. `char' refers to any ASCII
  711. character, `CHAR' to non-whitespace character.  Brackets `[]' indicate
  712. optional parameters; `<count>' also optional, usually defaulting to 1.
  713. Brackets are elided for `<count>' to eschew obfuscation.
  714.  
  715.    The usual Emacs convention is used to indicate Control Characters,
  716. i.e C-h for Control-h. *Do not confuse this to mean the separate
  717. characters C - h!!!* The `^' is itself, never used to indicate a
  718. Control character.
  719.  
  720. 
  721. File: viper.info,  Node: Text Handling,  Next: Display,  Prev: Groundwork,  Up: Commands
  722.  
  723. Text Handling
  724. =============
  725.  
  726. * Menu:
  727.  
  728. * Move Commands::        Moving, Searching
  729. * Marking::                Textmarkers in Viper and the Emacs Mark.
  730. * Appending Text::        Text insertion, Shifting, Putting
  731. * Editing in Insert State::    Autoindent, Quoting etc.
  732. * Deleting Text::        Deleting
  733. * Changing Text::        Changing, Replacement, Joining
  734. * Search and Replace::        Searches, Query Replace, Pattern Commands
  735. * Yanking::            Yanking, Viewing Registers
  736. * Undoing::            Multiple Undo, Backups
  737.  
  738. 
  739. File: viper.info,  Node: Move Commands,  Next: Marking,  Up: Text Handling
  740.  
  741. Move Commands
  742. -------------
  743.  
  744. `<count>  h  C-h'
  745.      <count> chars to the left.
  746.  
  747. `<count>  j  <lf> C-n'
  748.      <count> lines downward.
  749.  
  750. `<count>  l  <sp>'
  751.      <count> chars to the right.
  752.  
  753. `<count>  k  C-p'
  754.      <count> lines upward.
  755.  
  756. `<count>  $'
  757.      To the end of line <count> from the cursor.
  758.  
  759. `<count>  ^'
  760.      To the first CHAR <count> - 1 lines lower.
  761.  
  762. `<count>  -'
  763.      To the first CHAR <count> lines higher.
  764.  
  765. `<count>  +  <cr>'
  766.      To the first CHAR <count> lines lower.
  767.  
  768. `0'
  769.      To the first char of the line.
  770.  
  771. `<count> |'
  772.      To column <count>
  773.  
  774. `<count>  f<char>'
  775.      <count> <char>s to the right (find).
  776.  
  777. `<count>  t<char>'
  778.      Till before <count> <char>s to the right.
  779.  
  780. `<count>  F<char>'
  781.      <count> <char>s to the left.
  782.  
  783. `<count>  T<char>'
  784.      Till after <count> <char>s to the left.
  785.  
  786. `<count>  ;'
  787.      Repeat latest `f t F T' <count> times.
  788.  
  789. `<count>  ,'
  790.      Repeat latest `f t F T' <count> times in opposite direction.
  791.  
  792. `<count>  w'
  793.      <count> words forward.
  794.  
  795. `<count>  W'
  796.      <count> WORDS forward.
  797.  
  798. `<count>  b'
  799.      <count> words backward.
  800.  
  801. `<count>  B'
  802.      <count> WORDS backward.
  803.  
  804. `<count>  e'
  805.      To the end of word <count> forward.
  806.  
  807. `<count>  E'
  808.      To the end of WORD <count> forward.
  809.  
  810. `<count>  G'
  811.      Go to line <count> (default end-of-file).
  812.  
  813. `<count>  H'
  814.      To line <count> from top of the screen (home).
  815.  
  816. `<count>  L'
  817.      To line <count> from bottom of the screen (last).
  818.  
  819. `M'
  820.      To the middle line of the screen.
  821.  
  822. `<count>  )'
  823.      <count> sentences forward.
  824.  
  825. `<count>  ('
  826.      <count> sentences backward.
  827.  
  828. `<count>  }'
  829.      <count> paragraphs forward.
  830.  
  831. `<count>  {'
  832.      <count> paragraphs backward.
  833.  
  834. `<count>  ]]'
  835.      To the <count>th heading.
  836.  
  837. `<count>  [['
  838.      To the <count>th previous heading.
  839.  
  840. `<count>  []'
  841.      To the end of <count>th heading.
  842.  
  843. `m<a-z>'
  844.      Mark the cursor position with a letter.
  845.  
  846. ``<a-z>'
  847.      To the mark.
  848.  
  849. `'<a-z>'
  850.      To the first CHAR of the line with the mark.
  851.  
  852. `[<a-z>'
  853.      Show contents of textmarker.
  854.  
  855. `]<a-z>'
  856.      Show contents of register.
  857.  
  858. ```'
  859.      To the cursor position before the latest absolute jump (of which
  860.      are examples `/' and `G').
  861.  
  862. `'''
  863.      To the first CHAR of the line on which the cursor was placed
  864.      before the latest absolute jump.
  865.  
  866. `<count>  /<string>'
  867.      To the <count>th occurrence of <string>.
  868.  
  869. `<count>  /<cr>'
  870.      To the <count>th occurrence of <string> from previous `/ or ?'.
  871.  
  872. `<count>  ?<string>'
  873.      To the <count>th previous occurrence of <string>.
  874.  
  875. `<count>  ?<cr>'
  876.      To the <count>th previous occurrence of <string> from previous `?
  877.      or /'.
  878.  
  879. `n'
  880.      Repeat latest `/' `?' (next).
  881.  
  882. `N'
  883.      Repeat latest search in opposite direction.
  884.  
  885. `C-c /'
  886.      Without a prefix argument, this command toggles
  887.      case-sensitive/case-insensitive search modes and plain
  888.      vanilla/regular expression search. With the prefix argument 1,
  889.      i.e., `1 C-c /', this toggles case-sensitivity; with the prefix
  890.      argument 2, toggles plain vanilla search and search using regular
  891.      expressions. *Note Viper Specials::, for alternative ways to invoke
  892.      this function.
  893.  
  894. `%'
  895.      Find the next bracket and go to its match.
  896.  
  897. 
  898. File: viper.info,  Node: Marking,  Next: Appending Text,  Prev: Move Commands,  Up: Text Handling
  899.  
  900. Marking
  901. -------
  902.  
  903.    Emacs mark is referred to in the region specifiers `r' and `R'.
  904. *Note Emacs Preliminaries:: and *note Basics::. for explanation. Also
  905. see *Note Mark: (emacs)Mark, for an explanation of the Emacs mark ring.
  906.  
  907. `m<a-z>'
  908.      Mark the current file and position with the specified letter.
  909.  
  910. `m .'
  911.      Set the Emacs mark (*Note Emacs Preliminaries::) at point.
  912.  
  913. `m <'
  914.      Set the Emacs mark at beginning of buffer.
  915.  
  916. `m >'
  917.      Set the Emacs mark at end of buffer.
  918.  
  919. `m ,'
  920.      Jump to the Emacs mark.
  921.  
  922. `:mark <char>'
  923.      Mark position with text marker named <char>. This is an Ex command.
  924.  
  925. `:k <char>'
  926.      Same as `:mark'.
  927.  
  928. ```'
  929.      Exchange point and mark.
  930.  
  931. `'''
  932.      Exchange point and mark and go to the first CHAR on line.
  933.  
  934. `'<a-z>'
  935.      Go to specified Viper mark.
  936.  
  937. `'
  938.      Go to specified Viper mark and go to the first CHAR on line.
  939.  
  940. 
  941. File: viper.info,  Node: Appending Text,  Next: Editing in Insert State,  Prev: Marking,  Up: Text Handling
  942.  
  943. Appending Text
  944. --------------
  945.  
  946.    *Note Options:: to see how to change tab and shiftwidth size. See
  947. the GNU Emacs manual, or try `C-ha tabs' (If you have turned Emacs help
  948. on).  Check out the variable `indent-tabs-mode' to put in just spaces.
  949. Also see options for word-wrap.
  950.  
  951. `<count>  a'
  952.      <count> times after the cursor.
  953.  
  954. `<count>  A'
  955.      <count> times at the end of line.
  956.  
  957. `<count>  i'
  958.      <count> times before the cursor (insert).
  959.  
  960. `<count>  I'
  961.      <count> times before the first CHAR of the line
  962.  
  963. `<count>  o'
  964.      On a new line below the current (open).  The count is only useful
  965.      on a slow terminal.
  966.  
  967. `<count>  O'
  968.      On a new line above the current.  The count is only useful on a
  969.      slow terminal.
  970.  
  971. `<count>  ><move>'
  972.      Shift the lines described by <count><move> one shiftwidth to the
  973.      right (layout!).
  974.  
  975. `<count>  >>'
  976.      Shift <count> lines one shiftwidth to the right.
  977.  
  978. `<count>  ["<a-z1-9>]p'
  979.      Put the contents of the (default undo) buffer <count> times after
  980.      the cursor. The register will be automatically downcased.
  981.  
  982. `<count>  ["<a-z1-9>]P'
  983.      Put the contents of the (default undo) buffer <count> times before
  984.      the cursor. The register will
  985.  
  986. `[<a-z>'
  987.      Show contents of textmarker.
  988.  
  989. `]<a-z>'
  990.      Show contents of register.
  991.  
  992. `<count>  .'
  993.      Repeat previous command <count> times. For destructive commands as
  994.      well as undo.
  995.  
  996. `f1 1 and f1 2'
  997.      While `.' repeats the last destructive command, these two macros
  998.      repeat the second-last and the third-last destructive commands.
  999.      *Note Vi Macros::, for more information on Vi macros.
  1000.  
  1001. `C-c M-p and C-c M-n'
  1002.      In Vi state, these commands help peruse the history of Vi's
  1003.      destructive commands.  Successive typing of `C-c M-p' causes Viper
  1004.      to search the history in the direction of older commands, while
  1005.      hitting `C-c M-n' does so in reverse order. Each command in the
  1006.      history is displayed in the Monibuffer. The displayed command can
  1007.      then be executed by typing ``.''.
  1008.  
  1009.      Since typing the above sequences of keys may be tedious, the
  1010.      functions doing the perusing can be bound to unused keyboard keys
  1011.      in the `~/.vip' file. *Note Viper Specials::, for details.
  1012.  
  1013. 
  1014. File: viper.info,  Node: Editing in Insert State,  Next: Deleting Text,  Prev: Appending Text,  Up: Text Handling
  1015.  
  1016. Editing in Insert State
  1017. -----------------------
  1018.  
  1019.    Minibuffer can be edited similarly to Insert state, and you can
  1020. switch between Insert/Replace/Vi states at will.  Some users prefer
  1021. plain Emacs feel in the Minibuffer. To this end, set
  1022. VIP-VI-STYLE-IN-MINIBUFFER to `nil'.
  1023.  
  1024. `C-v'
  1025.      Deprive the next char of its special meaning (quoting).
  1026.  
  1027. `C-h'
  1028.      One char back.
  1029.  
  1030. `C-w'
  1031.      One word back.
  1032.  
  1033. `C-u'
  1034.      Back to the begin of the change on the current line.
  1035.  
  1036. 
  1037. File: viper.info,  Node: Deleting Text,  Next: Changing Text,  Prev: Editing in Insert State,  Up: Text Handling
  1038.  
  1039. Deleting Text
  1040. -------------
  1041.  
  1042.    There is one difference in text deletion that you should be aware
  1043. of. This difference comes from Emacs and was adopted in Viper because
  1044. we find it very useful. In Vi, if you delete a line, say, and then
  1045. another line, these two deletions are separated and are put back
  1046. separately if you use the `p' command. In Emacs (and Viper), successive
  1047. series of deletions that are *not interrupted* by other commands are
  1048. lumped together, so the deleted text gets accumulated and can be put
  1049. back as one chunk. If you want to break a sequence of deletions so that
  1050. the newly deleted text could be put back separately from the previously
  1051. deleted text, you should perform a non-deleting action, e.g., move the
  1052. cursor one character in any direction.
  1053.  
  1054. `<count>  x'
  1055.      Delete <count> chars under and after the cursor.
  1056.  
  1057. `<count>  X'
  1058.      Delete <count> chars before the cursor.
  1059.  
  1060. `<count>  d<move>'
  1061.      Delete from point to endpoint of <count><move>.
  1062.  
  1063. `<count>  dd'
  1064.      Delete <count> lines.
  1065.  
  1066. `D'
  1067.      The rest of the line.
  1068.  
  1069. `<count>  <<move>'
  1070.      Shift the lines described by <count><move> one shiftwidth to the
  1071.      left (layout!).
  1072.  
  1073. `<count>  <<'
  1074.      Shift <count> lines one shiftwidth to the left.
  1075.  
  1076. 
  1077. File: viper.info,  Node: Changing Text,  Next: Search and Replace,  Prev: Deleting Text,  Up: Text Handling
  1078.  
  1079. Changing Text
  1080. -------------
  1081.  
  1082. `<count>  r<char>'
  1083.      Replace <count> chars by <char> - no <esc>.
  1084.  
  1085. `<count>  R'
  1086.      Overwrite the rest of the line, appending change COUNT - 1 times.
  1087.  
  1088. `<count>  s'
  1089.      Substitute <count> chars.
  1090.  
  1091. `<count>  S'
  1092.      Change <count> lines.
  1093.  
  1094. `<count>  c<move>'
  1095.      Change from begin to endpoint of <count><move>.
  1096.  
  1097. `<count>  cc'
  1098.      Change <count> lines.
  1099.  
  1100. `<count>  C'
  1101.      The rest of the line and <count> - 1 next lines.
  1102.  
  1103. `<count>  =<move>'
  1104.      Reindent the region described by move.
  1105.  
  1106. `<count>  ~'
  1107.      Switch lower and upper cases.
  1108.  
  1109. `<count>  J'
  1110.      Join <count> lines (default 2).
  1111.  
  1112. `:[x,y]s/<p>/<r>/<f>'
  1113.      Substitute (on lines x through y) the pattern <p> (default the
  1114.      last pattern) with <r>.  Useful flags <f> are `g' for `global'
  1115.      (i.e. change every non-overlapping occurrence of <p>) and `c' for
  1116.      `confirm' (type `y' to confirm a particular substitution, else `n'
  1117.      ).  Instead of `/' any punctuation CHAR unequal to <space> <tab>
  1118.      and <lf> can be used as delimiter.
  1119.  
  1120. `:[x,y]copy [z]'
  1121.      Copy text between `x' and `y' to the position after `z'.
  1122.  
  1123. `:[x,y]t [z]'
  1124.      Same as `:copy'.
  1125.  
  1126. `:[x,y]move [z]'
  1127.      Move text between `x' and `y' to the position after `z'.
  1128.  
  1129. `&'
  1130.      Repeat latest Ex substitute command, e.g.  `:s/wrong/good'.
  1131.  
  1132. `C-c /'
  1133.      Toggle case-sensitive search. With prefix argument, toggle
  1134.      vanilla/regular expression search.
  1135.  
  1136. `#c<move>'
  1137.      Change upper case characters in the region to lower case.
  1138.  
  1139. `#C<move>'
  1140.      Change lower case characters in the region to upper case.
  1141.  
  1142. `#q<move>'
  1143.      Insert specified string at the beginning of each line in the region
  1144.  
  1145. `C-c M-p and C-c M-n'
  1146.      In Insert and Replace states, these keys are bound to commands
  1147.      that peruse the history of the text previously inserted in other
  1148.      insert or replace commands. By repeatedly typing `C-c M-p' or `C-c
  1149.      M-n', you will cause Viper to insert these previously used strings
  1150.      one by one.  When a new string is inserted, the previous one is
  1151.      deleted.
  1152.  
  1153.      In Vi state, these keys are bound to functions that peruse the
  1154.      history of destructive Vi commands.  *Note Viper Specials::, for
  1155.      details.
  1156.  
  1157. 
  1158. File: viper.info,  Node: Search and Replace,  Next: Yanking,  Prev: Changing Text,  Up: Text Handling
  1159.  
  1160. Search and Replace
  1161. ------------------
  1162.  
  1163.    *Note Groundwork::, for Ex address syntax. *Note Options:: to see
  1164. how to get literal (non-regular-expression) search and how to stop
  1165. search from wrapping around.
  1166.  
  1167. `<count>  /<string>'
  1168.      To the <count>th occurrence of <string>.
  1169.  
  1170. `<count>  ?<string>'
  1171.      To the <count>th previous occurrence of <string>.
  1172.  
  1173. `<count>  g<move>'
  1174.      Search for the text described by move. (off by default)
  1175.  
  1176. `n'
  1177.      Repeat latest `/' `?' (next).
  1178.  
  1179. `N'
  1180.      Idem in opposite direction.
  1181.  
  1182. `%'
  1183.      Find the next bracket and go to its match
  1184.  
  1185. `:[x,y]g/<string>/<cmd>'
  1186.      Search globally [from line x to y] for <string> and execute the Ex
  1187.      <cmd> on each occurrence.
  1188.  
  1189. `:[x,y]v/<string>/<cmd>'
  1190.      Execute <cmd> on the lines that don't match.
  1191.  
  1192. `#g<move>'
  1193.      Execute the last keyboard macro for each line in the region.
  1194.      *Note Macros and Registers::, for more info.
  1195.  
  1196. `Q'
  1197.      Query Replace.
  1198.  
  1199. `:ta <name>'
  1200.      Search in the tags file where <name> is defined (file, line), and
  1201.      go to it.
  1202.  
  1203. `:[x,y]s/<p>/<r>/<f>'
  1204.      Substitute (on lines x through y) the pattern <p> (default the last
  1205.      pattern) with <r>.  Useful flags <f> are `g' for `global' (i.e.
  1206.      change every non-overlapping occurrence of <p>) and `c' for
  1207.      `confirm' (type `y' to confirm a particular substitution, else
  1208.      `n').  Instead of `/' any punctuation CHAR unequal to <space>
  1209.      <tab> and <lf> can be used as delimiter.
  1210.  
  1211. `&'
  1212.      Repeat latest Ex substitute command, e.g. `:s/wrong/good'.
  1213.  
  1214. 
  1215. File: viper.info,  Node: Yanking,  Next: Undoing,  Prev: Search and Replace,  Up: Text Handling
  1216.  
  1217. Yanking
  1218. -------
  1219.  
  1220. `<count>  y<move>'
  1221.      Yank from begin to endpoint of <count><move>.
  1222.  
  1223. `<count>  "<a-z>y<move>'
  1224.      Yank from begin to endpoint of <count><move> to register.
  1225.  
  1226. `<count>  "<A-Z>y<move>'
  1227.      Yank from begin to endpoint of <count><move> and append to
  1228.      register.
  1229.  
  1230. `<count>  yy'
  1231.      <count> lines.
  1232.  
  1233. `<count>  Y'
  1234.      Idem (should be equivalent to `y$' though).
  1235.  
  1236. `m<a-z>'
  1237.      Mark the cursor position with a letter.
  1238.  
  1239. `[<a-z>'
  1240.      Show contents of textmarker.
  1241.  
  1242. `]<a-z>'
  1243.      Show contents of register.
  1244.  
  1245. `<count>  ["<a-z1-9>]p'
  1246.      Put the contents of the (default undo) buffer <count> times after
  1247.      the cursor. The register will be automatically downcased.
  1248.  
  1249. `<count>  ["<a-z1-9>]P'
  1250.      Put the contents of the (default undo) buffer <count> times before
  1251.      the cursor. The register will
  1252.  
  1253. 
  1254. File: viper.info,  Node: Undoing,  Prev: Yanking,  Up: Text Handling
  1255.  
  1256. Undoing
  1257. -------
  1258.  
  1259. `u U'
  1260.      Undo the latest change.
  1261.  
  1262. `.'
  1263.      Repeat undo.
  1264.  
  1265. `:q!'
  1266.      Quit Vi without writing.
  1267.  
  1268. `:e!'
  1269.      Re-edit a messed-up file.
  1270.  
  1271. `:rec'
  1272.      Recover file from autosave. Viper also creates backup files that
  1273.      have a `~' appended to them.
  1274.  
  1275. 
  1276. File: viper.info,  Node: Display,  Next: File and Buffer Handling,  Prev: Text Handling,  Up: Commands
  1277.  
  1278. Display
  1279. =======
  1280.  
  1281. `C-g'
  1282.      At user level 1, give file name, status, current line number and
  1283.      relative position.
  1284.      At user levels 2 and higher, abort the current command.
  1285.  
  1286. `C-c g'
  1287.      Give file name, status, current line number and relative position
  1288.      - all user levels.
  1289.  
  1290. `C-l'
  1291.      Refresh the screen.
  1292.  
  1293. `<count> C-e'
  1294.      Expose <count> more lines at bottom, cursor stays put (if
  1295.      possible).
  1296.  
  1297. `<count> C-y'
  1298.      Expose <count> more lines at top, cursor stays put (if possible).
  1299.  
  1300. `<count> C-d'
  1301.      Scroll <count> lines downward (default the number of the previous
  1302.      scroll; initialization: half a page).
  1303.  
  1304. `<count> C-u'
  1305.      Scroll <count> lines upward (default the number of the previous
  1306.      scroll; initialization: half a page).
  1307.  
  1308. `<count> C-f'
  1309.      <count> pages forward.
  1310.  
  1311. `<count> C-b'
  1312.      <count> pages backward (in older versions `C-b' only works without
  1313.      count).
  1314.  
  1315. `<count> z<cr>'
  1316. `zH'
  1317.      Put line <count> at the top of the window (default the current
  1318.      line).
  1319.  
  1320. `<count> z-'
  1321. `zL'
  1322.      Put line <count> at the bottom of the window (default the current
  1323.      line).
  1324.  
  1325. `<count> z.'
  1326. `zM'
  1327.      Put line <count> in the center of the window (default the current
  1328.      line).
  1329.  
  1330.